import { potr } from "./seting/ds.js";
import { xx } from "./seting/database.js";

import Koa from "koa"
import Router from "koa-router"

let app = new Koa();
let router = new Router();

router.get('/',async(ctx,next)=>{
    ctx.body =  "Hello, Welcome to Koa!"
    console.log(ctx.method);
    
    
})

router.get('/users',async(ctx,next)=>{
    ctx.body=xx
})

let rou =async(ctx,next)=>{
    let time = new Date().toISOString();
    let method = ctx.request.method
    let url = ctx.request.URL

    console.log(`[INFO] [${time}] [${method}] [${url}]`)

}



app.use(router.routes()).use(router.allowedMethods());

app.listen(potr,()=>{
    console.log(`http://localhost:${potr}`)
})